package com.zhuiyun.project.api.video.userVideo.controller;

import com.zhuiyun.project.annotation.OptLog;
import com.zhuiyun.project.api.video.publishVideo.model.PublishVideoModel;
import com.zhuiyun.project.api.video.userVideo.service.UserVideoService;
import com.zhuiyun.project.common.controller.BaseController;
import com.zhuiyun.project.common.errorCode.CommonException;
import com.zhuiyun.project.common.response.CommonResult;
import com.zhuiyun.project.utils.constants.CommonConstants;
import com.zhuiyun.project.utils.pageUtil.PageRequest;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * @ClassName userVideoController
 * @Description TODO
 * @Author Administrator
 * @Date 2024/2/26 9:11
 **/

@RestController
@RequestMapping("/UserVideo")
@Slf4j
public class UserVideoController extends BaseController {
    @Autowired
    private UserVideoService userVideoService;

    /**
    * @Author qsh
    * @Description 查询分发视频
    * @Date 2024/2/26 9:55
    * @Return com.zhuiyun.project.common.response.CommonResult
    * @param publishVideoModel
* @param pageRequest
    */
    @GetMapping("/getUserVideoF")
    @ApiOperation(value = "查询分发视频接口")
    @OptLog(modular = "运营视频管理", type = CommonConstants.SELECT, describe = "分页查询分发视频")
    public CommonResult getUserVideoF(PublishVideoModel publishVideoModel, PageRequest pageRequest){
        log.info("分页查询分发视频");
        return CommonResult.ok(userVideoService.getUserVideoF(publishVideoModel,pageRequest));
    }

    /**
     * @Author qsh
     * @Description 查询推荐视频
     * @Date 2024/2/26 9:55
     * @Return com.zhuiyun.project.common.response.CommonResult
     * @param publishVideoModel
     * @param pageRequest
     */
    @GetMapping("/getUserVideoT")
    @ApiOperation(value = "查询推荐视频接口")
    @OptLog(modular = "运营视频管理", type = CommonConstants.SELECT, describe = "分页查询推荐视频")
    public CommonResult getUserVideoT(PublishVideoModel publishVideoModel, PageRequest pageRequest){
        log.info("分页查询推荐视频");
        return CommonResult.ok(userVideoService.getUserVideoT(publishVideoModel,pageRequest));
    }

    /**
     * @Author qsh
     * @Description 查询低质量视频
     * @Date 2024/2/26 9:55
     * @Return com.zhuiyun.project.common.response.CommonResult
     * @param publishVideoModel
     * @param pageRequest
     */
    @GetMapping("/getUserVideoD")
    @ApiOperation(value = "查询低质量视频接口")
    @OptLog(modular = "运营视频管理", type = CommonConstants.SELECT, describe = "分页查询低质量视频")
    public CommonResult getUserVideoD(PublishVideoModel publishVideoModel, PageRequest pageRequest){
        log.info("分页查询低质量视频");
        return CommonResult.ok(userVideoService.getUserVideoD(publishVideoModel,pageRequest));
    }

    /**
     * @Author qsh
     * @Description 查询运营下线视频
     * @Date 2024/2/26 9:55
     * @Return com.zhuiyun.project.common.response.CommonResult
     * @param publishVideoModel
     * @param pageRequest
     */
    @GetMapping("/getUserVideoX")
    @ApiOperation(value = "查询运营下线视频接口")
    @OptLog(modular = "运营视频管理", type = CommonConstants.SELECT, describe = "分页查询运营下线视频")
    public CommonResult getUserVideoX(PublishVideoModel publishVideoModel, PageRequest pageRequest){
        log.info("分页查询运营下线视频");
        return CommonResult.ok(userVideoService.getUserVideoX(publishVideoModel,pageRequest));
    }

    /**
     * @Author qsh
     * @Description 查询用户自删视频
     * @Date 2024/2/26 9:55
     * @Return com.zhuiyun.project.common.response.CommonResult
     * @param publishVideoModel
     * @param pageRequest
     */
    @GetMapping("/getUserVideoS")
    @ApiOperation(value = "查询用户自删视频接口")
    @OptLog(modular = "运营视频管理", type = CommonConstants.SELECT, describe = "分页查询分发视频")
    public CommonResult getUserVideoS(PublishVideoModel publishVideoModel, PageRequest pageRequest){
        log.info("分页查询用户自删视频");
        return CommonResult.ok(userVideoService.getUserVideoS(publishVideoModel,pageRequest));
    }

    /**
     * @Author qsh
     * @Description 绑定低质量视频
     * @Date 2023/12/15 15:30
     * @Return com.zhuiyun.project.common.response.CommonResult
     * @param videoIds
     */
    @PutMapping("/deleteVideoById/{videoIds}")
    @ApiOperation(value = "绑定低质量视频接口")
    @OptLog(modular = "视频管理", type = CommonConstants.DELETE, describe = "绑定低质量视频")
    public CommonResult DeleteVideoId(@PathVariable("videoIds") List<Integer> videoIds) throws CommonException {
        log.info("绑定低质量视频");
        return userVideoService.DeleteVideoById(videoIds);
    }
}
